<template>
  <div id="lightbox" @click="close">
    <div id="box">
      <swiper :options="swiperOptionBox">
          <swiper-slide v-for="item of boxImg" :key="item.id">
            <img class="swiper-img" :src="item.url">
          </swiper-slide>
          <!-- Optional controls -->
          <div class="swiper-pagination"  slot="pagination"></div>
        </swiper>
    </div>
  </div>
</template>

<script>
export default{
  name: 'lightbox',
  props: {
    boxImg: {
      type: Array,
      default () {
        return []
      }
    }
  },
  data () {
    return {
      swiperOptionBox: {
        pagination: '.swiper-pagination',
        paginationType: 'fraction',
        observerParents: true,
        observer: true
      }
    }
  },
  activated () {
  },
  methods: {
    close () {
      this.$emit('close')
    }
  }
}
</script>

<style lang="stylus" scoped>
  #box >>> .swiper-container
    overflow inherit
  #lightbox
    z-index 9999
    color #fff
    position fixed
    top: 0;left: 0;right: 0;bottom: 0;
    background-color #000
    display flex
    justify-content center
    flex-direction column
    .swiper-img
      width: 100%;
  .swiper-pagination
    color #fff
    bottom: -20px;
</style>
